﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TextTemplating.VSHost;
using System.Runtime.InteropServices;
using System.IO;
using System.Resources;

namespace ContinuousTestation.PresenterFirstDSL.CustomTool
{
    [Guid("33AA4E7A-E938-4b2b-A82C-EBCC1EC1FB85")]
    class P1DSLGenerator : TemplatedCodeGenerator 
    {
        protected override byte[] GenerateCode(string inputFileName, string inputFileContent)
        {
            ResourceManager manager = new ResourceManager("ContinuousTestation.PresenterFirstDSL.Properties.Resources",
                                    typeof(P1DSLGenerator).Assembly);
            
            FileInfo fi = new FileInfo(inputFileName);
            //You'll only need %MODELFILE% and %EXT% for a Hello World app.
            inputFileContent =
                manager.GetObject("Presenter").ToString()
                    .Replace("%MODELFILE%", fi.Name).ToString();
                    //.Replace("%NAMESPACE%", FileNameSpace)
                    //.Replace("%EXT%", fileExtension)
                    //.Replace("%PID%", currentProcess.Id.ToString());
          
            byte[] data = base.GenerateCode(inputFileName, inputFileContent);
            return data;
        }
    }
}
